package com.neusoft.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.neusoft.po.Food;

@Mapper
public interface FoodMapper {

	@Select("select * from food where businessId=#{businessId} order by foodId")
	public List<Food> listFoodByBusinessId(Integer businessId);
	
	@Select("select * from food where foodId=#{foodId}")
	public Food getFoodById(Integer foodId);
	
	@Select("select quantity from food where foodId=#{foodId}")
	public Integer getQuantityByFoodId(Integer foodId);

	@Update("update food set foodPrice=#{foodPrice} where foodId=#{foodId}")
	public Integer setFoodPriceByFoodId(@Param("foodId") Integer foodId, @Param("foodPrice") Double foodPrice);
	
	@Update("update food set quantity=#{quantity} where foodId=#{foodId}")
	public Integer setFoodQuantityByFoodId(@Param("foodId") Integer foodId, @Param("quantity") Integer quantity);
	
}
